<%@page language="java" contentType="text/html; character=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>商户后台</title>
    <link rel="stylesheet" href="${ctx}/resources/css/pintuer.css">
    <link rel="stylesheet" href="${ctx}/resources/css/admin.css">
    <script src="${ctx}/resources/js/jquery.js"></script>
    <script src="${ctx}/resources/js/pintuer.js"></script>
    <script src="${ctx}/resources/js/layer/layer.js"></script>
</head>
<body>
<div class="panel admin-panel">
	<div style=" width: 900px;height: 1000px; background-color: #ddd;  z-index: 10;position: fixed; top:0;left: 370px; margin: auto; display: none; id="imgform" >
		<img alt="" src="" id="bigimg">
	</div>
    <form action="${ctx}/seller/findSeller" id="listform" method="post">
        <div class="padding border-bottom">
            <ul class="search" style="padding-left: 10px;">
                <li>
                    <input type="text" placeholder="请输入用户名" name="sellerName" class="input" value="${obj.sellerName}"
                        style="width: 250px;line-height: 17px;display: inline-block" />
                    <a href="javascript:void(0)" onclick="changeSearch()" class="button border-main icon-search">搜索</a>
                </li>
            </ul>
        </div>
    </form>
    <table class="table table-hover text-center">
        <tr>
            <th>用户名</th>
            <th>手机号</th>
            <th>邮箱</th>
            <th>身份证</th>
            <th>营业执照</th>
            <th>状态信息</th>
            <th>操作</th>
        </tr>
    <c:forEach items="${pagers.datas}" var="data" varStatus="l">
        <tr >
            <td>${data.sellerName}</td>
            <td>${data.sellerPhone}</td>
            <td>${data.sellerEmail}</td>
            <td>${data.idCard}</td>
            <td><img src="${ctx }${data.business}" alt=""  style="width: 100px;height: 100px;" onclick="openimg('${data.sellerName}','${ctx}${data.business}')"/></td>
            <td>
            	<c:if test="${data.state == 0 }">
            		<input type="text" class="input" style="width: 50%;text-align: center;margin: auto;" name="State" readonly="readonly"   value="正常使用">
            	</c:if>
            	<c:if test="${data.state == 1 }">
            		<input type="text" class="input" style="width: 50%;text-align: center;margin: auto;" name="State" readonly="readonly"   value="已禁用">
            	</c:if>
            	<c:if test="${data.state == 2 }">
            		<input type="text" class="input" style="width: 50%;text-align: center;margin: auto;" name="State" readonly="readonly"   value="暂未启用">
            	</c:if>
            </td>
            <td>
            	<c:if test="${data.state == 0 }">
					<a class="button border-main" href="${ctx}/seller/disable?id=${data.id}"><span class="icon-edit">禁用</span> </a>
				</c:if>
				<c:if test="${data.state == 1 }">
					<a class="button border-main" href="${ctx}/seller/enable?id=${data.id}"><span class="icon-edit">启用</span> </a>
				</c:if>
				<c:if test="${data.state == 2 }">
					<a class="button border-main" href="${ctx}/seller/enable?id=${data.id}"><span class="icon-edit">启用</span> </a>
				</c:if>
				<a class="button border-red" href="${ctx}/seller/sdelete?id=${data.id}"><span class="icon-edit">删除</span> </a>
			</td>
        </tr>
    </c:forEach>
        <tr>
            <td colspan="8">
                <div class="pagelist">
                    <!--分页开始-->
                    <pg:pager url="${ctx}/seller/findSeller" maxIndexPages="5" items="${pagers.total}" maxPageItems="15" export="curPage=pageNumber">
                        <pg:last>
                            共${pagers.total}记录，共${pageNumber}页，
                        </pg:last>
                        当前第${curPage}页
                        <pg:first>
                            <a href="${pageUrl}">首页</a>
                        </pg:first>
                        <pg:prev>
                            <a href="${pageUrl}">上一页</a>
                        </pg:prev>
                        <pg:pages>
                            <c:choose>
                                <c:when test="${curPage eq pageNumber}">
                                    <font color="red">[${pageNumber}]</font>
                                </c:when>
                                <c:otherwise>
                                    <a href="${pageUrl}">${pageNumber}</a>
                                </c:otherwise>
                            </c:choose>
                        </pg:pages>
                        <pg:next>
                            <a href="${pageUrl}">下一页</a>
                        </pg:next>
                        <pg:last>
                            <c:choose>
                                <c:when test="${curPage eq pageNumber}">
                                    <font color="red">尾页</font>
                                </c:when>
                                <c:otherwise>
                                    <a href="${pageUrl}">尾页</a>
                                </c:otherwise>
                            </c:choose>
                        </pg:last>
                    </pg:pager>
                </div>
            </td>
        </tr>
    </table>
</div>
<script>
//弹出一个页面层
/* $('#imagegallery1 img#imagegallery').on('click', function(data){
	console.log(data);
  layer.open({
  type: 1,
  area: ['600px', '360px'],
  shadeClose: true, //点击遮罩关闭
  content: '\<\div style="padding:20px;">自定义内容\<\/div>'
  });
}); */
	function openimg(sellerName,data){
		layer.open({
			  type: 1,
			  title :'正在查看' + sellerName+ '的营业执照',
			  area: ['602px', '802px'],
			  shadeClose: true, //点击遮罩关闭
			  content: '\<\div style="padding:20px;"><img src="'+data+'" style="width: 100%;height: 100%; ">\<\/div>'
			  });
	}
    function changeSearch(){
        $("#listform").submit();
    }
</script>
</body>

</html>